﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="UploadFrm.aspx.cs" Inherits="WebApp.UploadFrm" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>文件上传</title>
    <link href="uploadify/uploadify.css" rel="stylesheet" type="text/css" />
    <link rel="stylesheet" type="text/css" href="js/jquery-easyui-1.3.2/themes/default/easyui.css" />
    <link rel="stylesheet" type="text/css" href="js/jquery-easyui-1.3.2/themes/icon.css" />

    <script src="js/jquery-easyui-1.3.2/jquery-1.8.0.min.js" type="text/javascript"></script>

    <script src="uploadify/jquery.uploadify.min.js" type="text/javascript"></script>

    <script type="text/javascript" src="js/Jquery.Query.js"></script>

    <script type="text/javascript">
        $(document).ready(function() {
            var orderId = $.query.get('OrderId');
            var userId = $.query.get('UserId');
            $(function() {
                $("#uploadify").uploadify({
                    height: 20,
                    formData: { 'OrderId': orderId, 'UserId': '<%=(Session["User"] as WebApp.BaseDataSvc.TB_User).id%>' },
                    swf: 'uploadify/uploadify.swf',
                    uploader: 'UploadHandler.ashx',
                    cancelImg: 'uploadify/uploadify-cancel.png',
                    width: 50,
                    multi: true,
                    buttonText: '选择...',
                    auto: false,
                    queueID: 'fileQueue',
                    fileTypeExts: '*.xls;*.xlsx;*.doc;*.docx;*.gif:*.jpeg;*.png;*.jpg;*.tif;*.pdf;*.bmp',
                    onUploadSuccess: function(file, data, response) {
                        //alert(data);
                        window.parent.bindFile(orderId);
                    }
                });

            });
        });

        function upload() {
            $('#uploadify').uploadify('upload', '*');
        }
        function cancel() {
            $('#uploadify').uploadify('cancel', '*');
        }  
    </script>

</head>
<body>
    <form id="form1" runat="server">
    <div style="text-align: center">
        <div id="fileQueue">
        </div>
        <input type="file" name="uploadify" id="uploadify" />
        <p>
            <a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-search'" onclick="upload();">
                上传</a>&nbsp;&nbsp;&nbsp;&nbsp;<a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-search'"
                    onclick="cancel();"> 取消上传</a>
        </p>
    </div>
    </form>
</body>
</html>
